package com.design.pattern.command;

import com.design.pattern.command.entity.CeilingFan;
import com.design.pattern.command.entity.Light;
import com.design.pattern.command.entity.Stereo;

public class CommandTest {
    public static void main(String[] args) {
        RemoteControl remoteControl = new RemoteControl();

        Light light = new Light();
        LightOnCommand lightOnCommand = new LightOnCommand(light);
        LightOffCommand lightOffCommand = new LightOffCommand(light);

        Stereo stereo = new Stereo();
        StereoOnCommand stereoOnCommand = new StereoOnCommand(stereo);
        StereoOffCommand stereoOffCommand = new StereoOffCommand(stereo);

        remoteControl.setCommand(1, lightOnCommand, lightOffCommand);
        remoteControl.setCommand(2, stereoOnCommand, stereoOffCommand);
        System.out.println(remoteControl);

        remoteControl.onButtonWasPushed(1);
        remoteControl.undoCommandWasPushed();
        remoteControl.offButtonWasPushed(1);

        remoteControl.onButtonWasPushed(2);
        remoteControl.offButtonWasPushed(2);

        CeilingFan ceilingFan = new CeilingFan("room");
        CeilingFanHighCommand ceilingFanHighCommand = new CeilingFanHighCommand(ceilingFan);
        CeilingFanMediumCommand ceilingFanMediumCommand = new CeilingFanMediumCommand(ceilingFan);
        CeilingFanLowCommand ceilingFanLowCommand = new CeilingFanLowCommand(ceilingFan);
        CeilingFanOffCommand ceilingFanOffCommand = new CeilingFanOffCommand(ceilingFan);

        remoteControl.setCommand(3,ceilingFanHighCommand,ceilingFanOffCommand);
        remoteControl.setCommand(4,ceilingFanMediumCommand,ceilingFanOffCommand);
        remoteControl.setCommand(5,ceilingFanLowCommand,ceilingFanOffCommand);

        System.out.println(remoteControl);

        remoteControl.onButtonWasPushed(3);
        remoteControl.onButtonWasPushed(4);
        remoteControl.onButtonWasPushed(5);
        // remoteControl.undoCommandWasPushed();

    }
}